package cn.changein.framework.model.setting.area.mapper;

import cn.changein.framework.model.setting.area.entity.Area;
import cn.changein.framework.model.setting.area.model.params.AreaParam;
import cn.changein.framework.model.setting.area.model.result.AreaResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 地区表 Mapper 接口
 * </p>
 *

 * @Date 2020-12-15
 * @Copyright: companyName
 * @Version 1.0
 * @Since JDK1.8
 */
public interface AreaMapper extends BaseMapper<Area> {

    /**
     * 获取列表
     *

     * @Date 2020-12-15
     */
    List<AreaResult> customList(@Param("paramCondition") AreaParam paramCondition);

    /**
     * 获取map列表
     *

     * @Date 2020-12-15
     */
    List<Map<String, Object>> customMapList(@Param("paramCondition") AreaParam paramCondition);

    /**
     * 获取分页实体列表
     *

     * @Date 2020-12-15
     */
    Page<AreaResult> customPageList(@Param("page") Page page, @Param("paramCondition") AreaParam paramCondition);

    /**
     * 获取分页map列表
     *

     * @Date 2020-12-15
     */
    Page<Map<String, Object>> customPageMapList(@Param("page") Page page, @Param("paramCondition") AreaParam paramCondition);

    @Select("select * from sys_area where parent_id=#{parentId} and delete_flag=0 ")
    List<Area> findByParentId(@Param("parentId") Long parentId);

    /**
     * @Description: 获取所有地区数据
     * @Date:2020/12/15 20:44
     * @Param: [paramCondition]

     */
    List<AreaResult> findListAllByAreaParam(@Param("paramCondition") AreaParam paramCondition);
}
